
const { times, concat } = require('async');
const { program, InvalidArgumentError } = require('commander');

// const check = (value) => {
//   var arr = value.split(',');
//   // var array =[...arr];
//   // // console.log('--' + array[0]);
//   // // var array = arr.concat(arr);
//   console.log('array:' + arr);
//   return arr;
// }

program
  .argument('<numbers>', 'this is a number')
  .option('-t, --times <times...>', 'this is a number')
  .action(async (numbers, options) => {
    await main(numbers, options.times);
  });

  program.parseAsync(process.argv)
  .then(() => {
    console.log('DONE');
    process.exit(0);
  })
  .catch((err) => {
    console.error(err);
    process.exit(1);
  });

async function main(numbers,times) {
  console.log('numbers=' + numbers);
  console.log('times=' + times);
  const time = times[0];
  console.log('time=' + time);
}